/*
package com.taiji.dianthus.sms;

import com.ejtone.mars.kernel.util.JsonUtil;
import com.mascloud.model.MoModel;
import com.mascloud.model.StatusReportModel;
import com.mascloud.sdkclient.Client;
import com.taiji.dianthus.common.BusinessMessage;
import com.taiji.dianthus.domain.sms.SmsInfo;
import com.taiji.dianthus.domain.sms.api.SmsDomain;
import com.taiji.dianthus.service.sms.SmsInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;


@Service
public class Sdk2SmsSendServiceImpl implements Sdk2SMSSendService {


    @Autowired
    private SmsInfoService smsInfoService;

    */
/**
     * @param smsInfo 短信
     * @param isMo    是否需要上行
     * @return
     *//*

    @Override
    public BusinessMessage sendDSMS(SmsInfo smsInfo, Boolean isMo) {
        BusinessMessage message = new BusinessMessage();
        message.setMsg("发送成功");
        message.setSuccess(true);
        message.setCode(1 + "");
        smsInfo.setMsgStatus(1);
        smsInfo.setMsgStatusMsg("发送成功");
        //TODO  发送短信
        //String msgGroup = UUID.randomUUID().toString().replaceAll("-", "");
        String mobilesStr = smsInfo.getReceiveUserPhone();
        String[] mobiles = mobilesStr.split(",");
        String msgGroup = UUID.randomUUID().toString().replaceAll("-", "");
       */
/* Client client = Client.getInstance();
        boolean isLoggedin = client.login(SmsConstant.URL, SmsConstant.USER_ACCOUNT,
                SmsConstant.PASSWORD, SmsConstant.ECNAME);
        if (!isLoggedin) {
            message.setMsg("登录短信平台失败");
            return message;
        }

        int resultCode = client.sendDSMS(mobiles, smsInfo.getMsgContent(), SmsConstant.ADDSERIAL,
                1, SmsConstant.SIGN, msgGroup, isMo);
        smsInfo.setMsgResultCode(resultCode + "");
        String resultMsg = SMSResultCodeEnum.getResultMsg(resultCode);
        smsInfo.setMsgResultMsg(resultMsg);
        //提交成功
        if (SMSResultCodeEnum.SUCCESS.equals(resultCode)) {

            //获取状态报告
            List<StatusReportModel> list = client.getReport();
            String errcode = null;
            String reportStatus = null;
            for (int i = 0; i < list.size(); i++) {
                if (msgGroup.equals(list.get(i).getMsgGroup())) {
                    errcode = list.get(i).getErrorCode();
                    reportStatus = list.get(i).getReportStatus();
                }
            }
            if ("CM:0000".equals(reportStatus)) {
                message.setMsg("发送成功");
                message.setSuccess(true);
                message.setCode(1 + "");
                smsInfo.setMsgStatus(1);
                smsInfo.setMsgStatusMsg("发送成功");
            } else {
                message.setMsg(SMSReportCodeEnum.getResultMsg(reportStatus));
                message.setCode(reportStatus);
                smsInfo.setMsgStatus(2);
                smsInfo.setMsgStatusMsg(SMSResultCodeEnum.getResultMsg(resultCode));
            }
        } else {
            message.setMsg(resultMsg);
            message.setCode(resultCode + "");
            smsInfo.setMsgStatus(2);
        }*//*

        smsInfo.setMsgGroup(msgGroup);
        smsInfo.setSmsPriority(1);
        //保存短信发送信息
        smsInfoService.save(smsInfo);
        return message;

//    }

    @Override
    public BusinessMessage sendDSMSForward(SmsDomain smsInfo, Boolean isMo) {
        BusinessMessage message = new BusinessMessage();
        String mobilesStr = smsInfo.getMobiles();
        String[] mobiles = mobilesStr.split(",");
        Client client = Client.getInstance();
        boolean isLoggedin = client.login(SmsConstant.URL, SmsConstant.USER_ACCOUNT,
                SmsConstant.PASSWORD, SmsConstant.ECNAME);
        if (!isLoggedin) {
            message.setMsg("登录短信平台失败");
            return message;
        }
        String msgGroup = UUID.randomUUID().toString().replaceAll("-", "");
       */
/* int resultCode = client.sendDSMS(mobiles, smsInfo.getSmsContent(), SmsConstant.ADDSERIAL,
                1, SmsConstant.SIGN, msgGroup, isMo);
        String resultMsg = SMSResultCodeEnum.getResultMsg(resultCode);
        //提交成功
        if (SMSResultCodeEnum.SUCCESS.equals(resultCode)) {

            //获取状态报告
            List<StatusReportModel> list = client.getReport();
            String errcode = null;
            String reportStatus = null;
            for (int i = 0; i < list.size(); i++) {
                if (msgGroup.equals(list.get(i).getMsgGroup())) {
                    errcode = list.get(i).getErrorCode();
                    reportStatus = list.get(i).getReportStatus();
                }
            }
            if ("CM:0000".equals(reportStatus)) {
                message.setMsg("发送成功");
                message.setSuccess(true);
                message.setCode(1 + "");
            } else {
                message.setMsg(SMSReportCodeEnum.getResultMsg(reportStatus));
                message.setCode(reportStatus);
            }
        } else {
            message.setMsg(resultMsg);
            message.setCode(resultCode + "");
        }*//*

        return message;
    }


	public static void main( String[] args ) {
		Client client = Client.getInstance( );
		// 登录地址需另外提供
		boolean isLoggedin = client.login(SmsConstant.URL, SmsConstant.USER_ACCOUNT,
                SmsConstant.PASSWORD, SmsConstant.ECNAME);
		if( isLoggedin ) {
			System.out.println( "Login successed" );
		} else {
			System.out.println( "Login failed" );
			return;
		}

		// 普通短信
		int rt = client.sendDSMS( new String[]{ "15101630605" }, "短信内容", "123", 1, "cwaH21lON", null, true );
		System.out.println( rt );

		// 模板短信
		int rtm = client.sendTSMS( new String[]{ "15101630605" }, "模板ID", new String[]{ "参数一", "参数二" }, "123", 0, "签名ID", null );
		System.out.println( rtm );

		// 获取状态报告——开始
		List<StatusReportModel> statusReportlist = client.getReport( );
		System.out.println( "getReport : " + JsonUtil.toJsonString( statusReportlist ) );
		// 获取状态报告——结束

		// 获取上行短信——开始
		List<MoModel> deliverList = client.getMO( );
		System.out.println( "getMO : " + JsonUtil.toJsonString( deliverList ) );
		// 获取上行短信——结束



	}
}
*/
